home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-30 | 3.0 KB | 122 lines | [TEXT/CWIE] |
- // ===========================================================================
- // LHiResCaption.cp
- // Dan Crevier <mailto:Dan.Crevier@pobox.com>
- // A subclass of LCaption that changes the text size proportionally if it is
- // enclosed in an LHiResPrinter. See LHiResPrintout for detials
-
- #ifdef PowerPlant_PCH
- #include PowerPlant_PCH
- #endif
-
- #include "LHiResCaption.h"
- #include <LCaption.h>
- #include <LStream.h>
- #include <UDrawingUtils.h>
- #include <UTextTraits.h>
- #include "LHiResPrintout.h"
-
- #ifndef __TEXTUTILS__
- #include <TextUtils.h>
- #endif
-
- // ---------------------------------------------------------------------------
- // • LHiResCaption
- // ---------------------------------------------------------------------------
- // Default Constructor
-
- LHiResCaption::LHiResCaption()
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • LHiResCaption(const LHiResCaption&)
- // ---------------------------------------------------------------------------
- // Copy Constructor
-
- LHiResCaption::LHiResCaption(
- const LHiResCaption &inOriginal)
- : LCaption(inOriginal)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • LHiResCaption(SPaneInfo&, Str255, ResIDT)
- // ---------------------------------------------------------------------------
- // Construct from parameters. Use this constructor to create a Caption
- // from runtime data.
-
- LHiResCaption::LHiResCaption(
- const SPaneInfo &inPaneInfo,
- ConstStringPtr inString,
- ResIDT inTextTraitsID)
- : LCaption(inPaneInfo, inString, inTextTraitsID)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • LHiResCaption(LStream*)
- // ---------------------------------------------------------------------------
- // Construct from data in a Stream
-
- LHiResCaption::LHiResCaption(
- LStream *inStream)
- : LCaption(inStream)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~LHiResCaption
- // ---------------------------------------------------------------------------
- // Destructor
-
- LHiResCaption::~LHiResCaption()
- {
- }
-
-
-
-
- // ---------------------------------------------------------------------------
- // • DrawSelf
- // ---------------------------------------------------------------------------
- // Draw the Caption
-
- void
- LHiResCaption::DrawSelf()
- {
- Rect frame;
-
- CalcLocalFrameRect(frame);
-
- Int16 just = UTextTraits::SetPortTextTraits(mTxtrID);
-
- RGBColor textColor;
- ::GetForeColor(&textColor);
-
- ApplyForeAndBackColors();
- ::RGBForeColor(&textColor);
-
- // look for LHiResPrintout as superview
- LView *super = GetSuperView();
- while(super != NULL)
- {
- LHiResPrintout *superPrintout = dynamic_cast<LHiResPrintout *>(super);
- // if it's a LHiResPrintout, resize the text
- if (superPrintout != NULL)
- {
- GrafPtr thePort;
- ::GetPort(&thePort);
- ::TextSize(thePort->txSize * superPrintout->GetResolution()/72);
- break;
- }
- super = super->GetSuperView();
- }
-
- UTextDrawing::DrawWithJustification((Ptr)&mText[1], mText[0],
- frame, just, true);
- }
-